package test;

import dao.SubjectMapper;
import entity.Subject;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.Reader;
import java.util.List;

public class SubjectFenYe {
    public static void main(String[] args) throws IOException {
        String resource = "mybatis-config.xml";
        Reader reader = Resources.getResourceAsReader(resource);
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
        SqlSession session = sqlSessionFactory.openSession(false);
        //List<Object> objects = session.selectList("cn.school.dao.SubjectMapper.findALL");
        SubjectMapper mapper = session.getMapper(SubjectMapper.class);
        System.out.println(mapper.getClass().getName());
        List<Subject> all = mapper.fenye(2,5);
        all.forEach(System.out::println);
        //session.commit();
        session.close();

    }
}
